#region Imported Namespaces



using System;
using System.Collections.ObjectModel;



#endregion


namespace WtfManager.Framework
{
  ///<summary>
  /// Represents a read-only observable collection of modules.
  ///</summary>
  public class ReadOnlyModulesCollection: ReadOnlyObservableCollection<Module>
  {
    #region Fields



    private readonly ModulesCollection _collection;



    #endregion


    #region Constructors/Finalizers



    ///<summary>
    /// Default ReadOnlyModulesCollection constructor.
    ///</summary>
    public ReadOnlyModulesCollection(ModulesCollection collection)
      : base(collection)
    {
      _collection = collection;
    }



    #endregion


    #region Properties/Indexers



    ///<summary>
    /// Gets a <see cref="Module"/> by its name.
    ///</summary>
    ///<param name="name">The name of a <see cref="Module"/> to get.</param>
    public Module this[string name]
    {
      get
      {
        return _collection[name];
      }
    }


    ///<summary>
    /// Gets a <see cref="Module"/> by its type.
    ///</summary>
    ///<param name="type">The type of a <see cref="Module"/> to get.</param>
    public Module this[Type type]
    {
      get
      {
        return _collection[type];
      }
    }



    #endregion
  }
}